package Demo1;

class MyThread extends Thread{
    @Override
    public void run() {
        try {
            while(true){
                System.out.println("hello thread");
                Thread.sleep(1000);
            }
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}

public class Demo2 {
    public void main(String[] args) {
        Thread thread=new MyThread();
        thread.start();
    }
}
